package com.indianic.example.tabpanel;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;

import com.hronline.EmployeesActivity;
import com.hronline.ManagerDashboardActivity;
import com.hronline.MoreActivity;
import com.hronline.PlannerActivity;
import com.hronline.R;
import com.hronline.TaskActivity;

public class MyTabHostProvider extends TabHostProvider 
{
	private Tab managerDashboardTab;
	private Tab plannerTab;
	private Tab employeesTab;
	private Tab taskTab;
	private Tab moreTab;
	
	private TabView tabView;
	private GradientDrawable gradientDrawable, transGradientDrawable;

	public MyTabHostProvider(Activity context) {
		super(context);
	}

	@Override
	public TabView getTabHost(String category) 
	{
		tabView = new TabView(context);
		tabView.setOrientation(TabView.Orientation.BOTTOM);
		tabView.setBackgroundID(R.drawable.tab_background_gradient);
		
		gradientDrawable = new GradientDrawable(
	            GradientDrawable.Orientation.TOP_BOTTOM,
	            new int[] {0xFFB2DA1D, 0xFF85A315});
	    gradientDrawable.setCornerRadius(0f);
	    gradientDrawable.setDither(true);
	    
	    transGradientDrawable = new GradientDrawable(
	            GradientDrawable.Orientation.TOP_BOTTOM,
	            new int[] {0x00000000, 0x00000000});
	    transGradientDrawable.setCornerRadius(0f);
	    transGradientDrawable.setDither(true);

	    managerDashboardTab = new Tab(context, category);
	    managerDashboardTab.setIcon(R.drawable.tabbar_home);
	    managerDashboardTab.setIconSelected(R.drawable.tabbar_home);
	    managerDashboardTab.setBtnText("Home");
	    managerDashboardTab.setBtnTextColor(Color.WHITE);
		managerDashboardTab.setSelectedBtnTextColor(Color.BLACK);
//		homeTab.setBtnColor(Color.parseColor("#00000000"));
//		homeTab.setSelectedBtnColor(Color.parseColor("#0000FF"));
		managerDashboardTab.setBtnGradient(transGradientDrawable);
		managerDashboardTab.setSelectedBtnGradient(gradientDrawable);
		managerDashboardTab.setIntent(new Intent(context, ManagerDashboardActivity.class));

		plannerTab = new Tab(context, category);
		plannerTab.setIcon(R.drawable.tabbar_planner);
		plannerTab.setIconSelected(R.drawable.tabbar_planner);
		plannerTab.setBtnText("Contact");
		plannerTab.setBtnTextColor(Color.WHITE);
		plannerTab.setSelectedBtnTextColor(Color.BLACK);
//		contactTab.setBtnColor(Color.parseColor("#00000000"));
//		contactTab.setSelectedBtnColor(Color.parseColor("#0000FF"));
		plannerTab.setBtnGradient(transGradientDrawable);
		plannerTab.setSelectedBtnGradient(gradientDrawable);
		plannerTab.setIntent(new Intent(context, PlannerActivity.class));

		employeesTab = new Tab(context, category);
		employeesTab.setIcon(R.drawable.tabbar_employees);
		employeesTab.setIconSelected(R.drawable.tabbar_employees);
		employeesTab.setBtnText("Employees");
		employeesTab.setBtnTextColor(Color.WHITE);
		employeesTab.setSelectedBtnTextColor(Color.BLACK);
//		shareTab.setBtnColor(Color.parseColor("#00000000"));
//		shareTab.setSelectedBtnColor(Color.parseColor("#0000FF"));
		employeesTab.setBtnGradient(transGradientDrawable);
		employeesTab.setSelectedBtnGradient(gradientDrawable);
		employeesTab.setIntent(new Intent(context, EmployeesActivity.class));
		
		taskTab = new Tab(context, category);
		taskTab.setIcon(R.drawable.tabbar_tasks);
		taskTab.setIconSelected(R.drawable.tabbar_tasks);
		taskTab.setBtnText("Task");
		taskTab.setBtnTextColor(Color.WHITE);
		taskTab.setSelectedBtnTextColor(Color.BLACK);
//		shareTab.setBtnColor(Color.parseColor("#00000000"));
//		shareTab.setSelectedBtnColor(Color.parseColor("#0000FF"));
		taskTab.setBtnGradient(transGradientDrawable);
		taskTab.setSelectedBtnGradient(gradientDrawable);
		taskTab.setIntent(new Intent(context, TaskActivity.class));
		
		moreTab = new Tab(context, category);
		moreTab.setIcon(R.drawable.more_sel);
		moreTab.setIconSelected(R.drawable.more_sel);
		moreTab.setBtnText("More");
		moreTab.setBtnTextColor(Color.WHITE);
		moreTab.setSelectedBtnTextColor(Color.BLACK);
//		moreTab.setBtnColor(Color.parseColor("#00000000"));
//		moreTab.setSelectedBtnColor(Color.parseColor("#0000FF"));
		moreTab.setBtnGradient(transGradientDrawable);
		moreTab.setSelectedBtnGradient(gradientDrawable);
		moreTab.setIntent(new Intent(context, MoreActivity.class));

		tabView.addTab(managerDashboardTab);
		tabView.addTab(plannerTab);
		tabView.addTab(employeesTab);
		tabView.addTab(taskTab);
		tabView.addTab(moreTab);

		return tabView;
	}
}